#define DEBUG
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

using namespace std;

const int maxn=4096;

void makeSeq(int n, FILE *f) {
  static bool book[maxn+1];
  memset(book, 0, sizeof(book));
  for (int i=1; i<=n; i++) {
    int x = rand()%(n-i+1)+1;
    for (int j=1; j<=n; j++) {
      if (!book[j]) {
	x--;
      }
      if (!x) {
	book[j] = true;
	fprintf(f, "%d ", j);
	break;
      }
    }
  }
}

void makeData(int n, FILE *f) {
  fprintf(f, "%d\n", n);
  makeSeq(n, f);
  fprintf(f, "\n");
  makeSeq(n, f);
}

int main() {
  srand(time(0));
  FILE *f = fopen("swap.in", "w");
  makeData(4096, f);
  fclose(f);
  return 0;
}
